package GridGames;

public class Grid {
	Cell[][] grid;
	int width, height;
	public Grid(int width, int height){
		grid = new Cell[width][height]; 
		initGrid();//Cells default to STATE.NONE
		this.width = width;
		this.height = height;
	}
	
	public Grid(){
		initGrid();
	}
	
	public void initGrid(){
		for(int x = 0; x < width; x++){
			for(int c = 0; c < height; c++){
				grid[x][c] = new Cell();
			}
		}
	}
	
	public void resetGrid(State state){
		for(int x = 0; x < width; x++){
			for(int c = 0; c < height; c++){
				this.grid[x][c].state = state;
			}
		}
	}
	
	public void printGrid(){
		for(int x = 0; x < height; x++){
			for(int c = 0; c < width; c++){
				System.out.print(grid[x][c].state);
			}
			System.out.println();
		}
	}
}

class Cell{
	State state = State.TRUE;
	public Cell(State state){
		this.state = state;
	}
	
	public Cell(){
		this.state = State.NONE;
	}
	
	public State getState(){
		return this.state;
	}
	
	public void flipState()
	{
		if(state == State.TRUE)
		{
			state = State.FALSE;
		}
		else
		{
			state = State.TRUE;
		}
	}
	
	public void setState(State state){
		this.state = state;
	}
	

}